<!DOCTYPE html>
<html>
<head>
<title>I LOVE U</title>
<style>
body {
  margin: 0;
  overflow: hidden;
  background-color: black;
}

#heart-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.heart {
  position: absolute;
  /* 随机大小 */
  width: var(--heart-size);
  height: var(--heart-size);
  background-color: #ffb6c1; /* 梦幻粉色 */
  clip-path: path('M12 4.248c-3.148-5.402-11.152-1.69-11.152 5.676 0 6.126 9.482 11.733 11.152 12.852 1.67-1.119 11.152-6.726 11.152-12.852 0-7.365-8.004-11.075-11.152-5.676z');
  -webkit-clip-path: path('M12 4.248c-3.148-5.402-11.152-1.69-11.152 5.676 0 6.126 9.482 11.733 11.152 12.852 1.67-1.119 11.152-6.726 11.152-12.852 0-7.365-8.004-11.075-11.152-5.676z');
  animation: flutter 4s linear infinite, glow 1.5s alternate infinite;
  will-change: transform, opacity;
  /* 朦胧效果 */
  filter: blur(2px); /* 调整模糊值以达到合适的朦胧感 */
  opacity: 0.7; /* 调整不透明度以增加朦胧感 */
}

@keyframes flutter {
  0% {
    transform: translateY(0) translateX(0) scale(0);
    opacity: 0;
  }
  10% {
    opacity: 0.7;
    transform: scale(1);
  }
  90% {
    opacity: 0.7;
  }

  100% {
    transform: translateY(calc(100vh + 30px)) translateX(var(--random-x)) scale(0);
    opacity: 0;
  }
}

@keyframes glow {
  0% {
    box-shadow: 0 0 15px rgba(255, 182, 193, 0.7); /* 梦幻粉色光晕 */
  }
  100% {
    box-shadow: 0 0 30px rgba(255, 182, 193, 0.5); /* 更强光晕 */
  }
}

#love-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 5em;
  font-family: sans-serif;
  color: lightblue;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  animation: fadeInOut 4s ease-in-out infinite, textGlow 1.5s alternate infinite;
  opacity: 0.8;
  will-change: opacity, transform;
}

@keyframes fadeInOut {
  0%,
  100% {
    opacity: 0.8;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.05);
  }
}

@keyframes textGlow {
  0% {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  }
  100% {
    text-shadow: 2px 2px 10px rgba(0, 173, 216, 0.8);
  }
}
</style>
</head>
<body>

<div id="heart-container"></div>
<div id="love-text">I LOVE U</div>

<script>
const heartContainer = document.getElementById('heart-container');
const targetHeartCount = 100;
let heartCount = 0;

function createHeart() {
  const heart = document.createElement('div');
  heart.className = 'heart';

  const randomX = Math.random() * 100 - 50;
  const randomRotate = Math.random();
  // 随机大小
  const randomSize = Math.random() * 20 + 20; // 大小在 20px 到 40px 之间
  heart.style.setProperty('--heart-size', `${randomSize}px`);

  heart.style.setProperty('--random-x', `${randomX}vw`);
  heart.style.setProperty('--random-rotate', randomRotate);

  heart.style.left = `${Math.random() * 100}vw`;
  heart.style.top = `${Math.random() * 100}vh`;

  heartContainer.appendChild(heart);
  heartCount++;

  heart.addEventListener('animationend', () => {
    heart.remove();
    heartCount--;
  });
}

// 初始填充心形
while (heartCount < targetHeartCount) {
    createHeart();
}

// 定时检查心形数量，并进行补充
setInterval(() => {
    while (heartCount < targetHeartCount) {
        createHeart();
    }
}, 50);
</script>

</body>
</html>